package com.mx.recycle_adapt

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.mx.recycle_adapt.activity.AnyTypeActivity
import com.mx.recycle_adapt.activity.BannerActivity
import com.mx.recycle_adapt.activity.IndexedActivity
import com.mx.recycle_adapt.activity.ScrollerViewActivity
import com.mx.recycle_adapt.adapt.HomeAdapt
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)


        val adapt = HomeAdapt(
            arrayListOf(
                HomePages("普通的一个RecycleView", IndexedActivity::class.java),
                HomePages("滚动选择View", ScrollerViewActivity::class.java),
                HomePages("多类型RecycleView", AnyTypeActivity::class.java),
                HomePages("Banner", BannerActivity::class.java),
            )
        )
        recycleView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
        recycleView.adapter = adapt
        adapt.setItemClick { index, record ->
            startActivity(Intent(this, record.clazz))
        }
    }
}